package com.study.demo.repository;

import com.study.demo.dto.Pos;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;

@Repository
public interface PosRepository extends JpaRepository<Pos, Serializable> {

    Pos findById(Integer id);

    @Transactional
    @Modifying
    @Query("update Pos p set p.pos=?1 where p.id=1")
    void updatePos(int position);
}
